|
cmd/gc: reduce memory consumption
This change introduces a new struct FuncNode and moves fields from
Node to FuncNode. Node and FuncNode are logically the same object,
thus for each FuncNode it holds true that (n->funcnode->node == n)
and (aFuncNode->node->funcnode == aFuncNode).
The fact that Node and FuncNode are logically the same object means
that the semantics of the original C code remains unchanged.
Reduced memory consumption is achieved because FuncNode is allocated
only if it is needed.
The new function funcnode() will allocate a FuncNode on demand. It
is recommended to always call this function when going from a Node to
to its FuncNode, unless circumstances are against this recommendation.
Similarly, the new struct UncommonNode contains fields of Node which
are specific to a small number of Node instances. The accessor function
unode() will allocate an UncommonNode on demand.
Although this patch affects y.tab.h and y.tab.c, these two files are
omitted from the patch.
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+488 lines, -384 lines) |
Patch |
|
M |
src/cmd/5g/gg.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/5g/ggen.c
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/5g/reg.c
|
View
|
1
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/cmd/6g/gg.h
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/6g/ggen.c
|
View
|
1
2
|
3 chunks |
+3 lines, -3 lines |
0 comments
|
Download
|
|
M |
src/cmd/6g/reg.c
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/cmd/8g/gg.h
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/8g/ggen.c
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/8g/reg.c
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/closure.c
|
View
|
1
2
|
8 chunks |
+50 lines, -43 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/dcl.c
|
View
|
1
2
|
9 chunks |
+25 lines, -25 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/esc.c
|
View
|
1
2
|
17 chunks |
+30 lines, -30 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/export.c
|
View
|
1
2
|
4 chunks |
+12 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/fmt.c
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
src/cmd/gc/gen.c
|
View
|
1
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/go.h
|
View
|
1
2
|
16 chunks |
+62 lines, -35 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/go.y
|
View
|
1
2
|
22 chunks |
+45 lines, -38 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/init.c
|
View
|
1
|
3 chunks |
+12 lines, -9 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/inl.c
|
View
|
1
2
|
15 chunks |
+54 lines, -53 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/lex.c
|
View
|
1
2
|
6 chunks |
+8 lines, -8 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/order.c
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/pgen.c
|
View
|
1
2
|
7 chunks |
+14 lines, -14 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/racewalk.c
|
View
|
1
2
|
2 chunks |
+7 lines, -7 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/sinit.c
|
View
|
1
2
|
9 chunks |
+10 lines, -10 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/subr.c
|
View
|
1
2
|
19 chunks |
+99 lines, -44 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/swt.c
|
View
|
1
|
3 chunks |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/typecheck.c
|
View
|
1
2
|
6 chunks |
+14 lines, -14 lines |
0 comments
|
Download
|
|
M |
src/cmd/gc/walk.c
|
View
|
1
2
|
10 chunks |
+21 lines, -21 lines |
0 comments
|
Download
|
Total messages: 13
|