• Russ Cox's avatar
    cmd/6c, cmd/8c: cut stack frames by about half · 139448fe
    Russ Cox authored
    The routine that adds an automatic to the stack was
    adding ptrsize-1 to the size before rounding up.
    That addition would only make sense to turn a round down
    into a round up. Before a round up, it just wastes a word.
    
    The effect was that a 6c function with one local and
    one two-word function call used (8+8)+(16+8) = 40 bytes
    instead of 8+16 = 24 bytes.
    
    The wasted space mostly didn't matter, but one place where
    it does matter is when trying to stay within the 128-byte
    total frame constraint for #pragma textflag 7 functions.
    
    This only affects the C compilers, not the Go compilers.
    
    5c already had correct code, which is now copied to 6c and 8c.
    
    R=ken2
    CC=golang-dev
    https://golang.org/cl/7303099
    139448fe
swt.c 12.4 KB