aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iexport.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-03-05 09:49:28 -0800
committerKeith Randall <khr@golang.org>2021-03-09 17:51:10 +0000
commitb60a3a8cfbc6096babe72ebcee0733bba496cf9a (patch)
tree8918e38b1c3e9e98a57988bd677f904a7e44700d /src/cmd/compile/internal/typecheck/iexport.go
parenta70eb2c9f2e3d52116b90a21ce10718356197ee5 (diff)
downloadgo-b60a3a8cfbc6096babe72ebcee0733bba496cf9a.tar.gz
go-b60a3a8cfbc6096babe72ebcee0733bba496cf9a.zip
cmd/compile: add debugging mode for import/export
Just add a simple magic number with each op, to detect when the reader gets desynchronized from the writer. Change-Id: Iac7dab7f465b0021b1d7ae31c8f8a353ac3663a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/299769 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iexport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 38ac753201..6f33ca1597 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -246,6 +246,11 @@ const (
interfaceType
)
+const (
+ debug = false
+ magic = 0x6742937dc293105
+)
+
func WriteExports(out *bufio.Writer) {
p := iexporter{
allPkgs: map[*types.Pkg]bool{},
@@ -1584,6 +1589,9 @@ func (w *exportWriter) expr(n ir.Node) {
}
func (w *exportWriter) op(op ir.Op) {
+ if debug {
+ w.uint64(magic)
+ }
w.uint64(uint64(op))
}