package liveness
import (
- "crypto/md5"
"crypto/sha1"
"fmt"
"os"
loff = objw.BitVec(&liveSymTmp, loff, locals)
}
- // Give these LSyms content-addressable names,
- // so that they can be de-duplicated.
- // This provides significant binary size savings.
- //
// These symbols will be added to Ctxt.Data by addGCLocals
// after parallel compilation is done.
- makeSym := func(tmpSym *obj.LSym) *obj.LSym {
- return base.Ctxt.LookupInit(fmt.Sprintf("gclocals·%x", md5.Sum(tmpSym.P)), func(lsym *obj.LSym) {
- lsym.P = tmpSym.P
- lsym.Set(obj.AttrContentAddressable, true)
- })
- }
- return makeSym(&argsSymTmp), makeSym(&liveSymTmp)
+ return base.Ctxt.GCLocalsSym(argsSymTmp.P), base.Ctxt.GCLocalsSym(liveSymTmp.P)
}
// Entry pointer for Compute analysis. Solves for the Compute of
import (
"cmd/internal/goobj"
"cmd/internal/objabi"
+ "crypto/md5"
"fmt"
"internal/buildcfg"
"log"
})
}
+// GCLocalsSym generates a content-addressable sym containing data.
+func (ctxt *Link) GCLocalsSym(data []byte) *LSym {
+ return ctxt.LookupInit(fmt.Sprintf("gclocals·%x", md5.Sum(data)), func(lsym *LSym) {
+ lsym.P = data
+ lsym.Set(AttrContentAddressable, true)
+ })
+}
+
// Assign index to symbols.
// asm is set to true if this is called by the assembler (i.e. not the compiler),
// in which case all the symbols are non-package (for now).