Commit a1a10ade authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 48043365
...@@ -753,7 +753,11 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error { ...@@ -753,7 +753,11 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
} }
} }
// TODO export hash // emit export hash symbol
text.emit("\n---- 8< ----")
fmt.Fprintf(text, "%s", traceExport(tpkg, kind))
text.emit("---- 8< ----\n")
//text.emit("var xxx_export_%s bool", traceExportHash(tpkg, kind))
// code for trace:import imports // code for trace:import imports
for _, timport := range tpkg.Importv { for _, timport := range tpkg.Importv {
...@@ -836,10 +840,9 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error { ...@@ -836,10 +840,9 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
return nil return nil
} }
// traceExportHash computes signature of tracing-related exports of a package // traceExport returns signatures of all tracing-related exports of a package
func traceExportHash(tpkg *Package, kind string) string { // in canonical order as would be seen from universe scope
// implementation: it is sha1 of associated header + importing code as func traceExport(tpkg *Package, kind string) []byte {
// if it was executed from universe scope
pkgpath := tpkg.Pkgi.Pkg.Path() pkgpath := tpkg.Pkgi.Pkg.Path()
pkgname := tpkg.Pkgi.Pkg.Name() pkgname := tpkg.Pkgi.Pkg.Name()
...@@ -859,7 +862,14 @@ func traceExportHash(tpkg *Package, kind string) string { ...@@ -859,7 +862,14 @@ func traceExportHash(tpkg *Package, kind string) string {
} }
} }
return fmt.Sprintf("%x", sha1.Sum(exported.Bytes())) return exported.Bytes()
}
// traceExportHash computes signature of tracing-related exports of a package
// implementation note: it is sha1 of associated header + importing code as
// if it was executed from universe scope.
func traceExportHash(tpkg *Package, kind string) string {
return fmt.Sprintf("%x", sha1.Sum(traceExport(tpkg, kind)))
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment