]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/5l: move offset2 into Adr.u0 union to save 4/8 bytes for Adr/Prog resp.
authorShenghou Ma <minux.ma@gmail.com>
Mon, 21 Jan 2013 18:50:27 +0000 (02:50 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 21 Jan 2013 18:50:27 +0000 (02:50 +0800)
sizeof(Adr) from 24 bytes down to 20 bytes.
sizeof(Prog) from 84 bytes down to 76 bytes.

5l linking cmd/godoc statistics:
Before:
Maximum resident set size (kbytes): 106668
After:
Maximum resident set size (kbytes):  99412

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7100059

src/cmd/5l/l.h

index 21a3bced8ea644010c721493d64168e565c90d22..dfa86df6e231522142b554feacc07c34e296daa1 100644 (file)
@@ -68,21 +68,24 @@ struct      Adr
 {
        union
        {
-               int32   u0offset;
+               struct {
+                       int32   offset;
+                       int32   offset2; // argsize
+               } u0off;
                char*   u0sval;
                Ieee    u0ieee;
                char*   u0sbig;
        } u0;
        Sym*    sym;
        Sym*    gotype;
-       int32   offset2; // argsize
        char    type;
        char    reg;
        char    name;
        char    class;
 };
 
-#define        offset  u0.u0offset
+#define        offset  u0.u0off.offset
+#define        offset2 u0.u0off.offset2
 #define        sval    u0.u0sval
 #define        scon    sval
 #define        ieee    u0.u0ieee