mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
This CL reorganizes export writing in preparation for unified IR: 1. It moves dumpexport into noder as noder.WriteExports so that it can be extended to include unified IR's export data. 2. Adds an "extensions" flag to typecheck.WriteExports to control whether the compiler-only extension data (e.g., function bodies and linker symbol info) is included in the exports. 3. It moves the gc.exporter type into typecheck and renames it to "crawler". The type originated as the implementation of the (pre-iexport) binary exporter, but since the removal of bexport it's been relegated to simply crawling the exported functions/bodies graph to identify which inline bodies need to be included. 4. It changes inline.Inline_Flood into the method crawler.markInlBody. Inline_Flood doesn't actually have anything to do with the rest of inlining; its current name and location are just historical quirks. Passes toolstash -cmp. Change-Id: I6445e2de9d3ce500a3aded5a8e20b09f46d23dbc Reviewed-on: https://go-review.googlesource.com/c/go/+/325212 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
26 lines
686 B
Go
26 lines
686 B
Go
// Copyright 2021 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package noder
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"cmd/compile/internal/base"
|
|
"cmd/compile/internal/typecheck"
|
|
"cmd/internal/bio"
|
|
)
|
|
|
|
func WriteExports(out *bio.Writer) {
|
|
// The linker also looks for the $$ marker - use char after $$ to distinguish format.
|
|
out.WriteString("\n$$B\n") // indicate binary export format
|
|
off := out.Offset()
|
|
typecheck.WriteExports(out, true)
|
|
size := out.Offset() - off
|
|
out.WriteString("\n$$\n")
|
|
|
|
if base.Debug.Export != 0 {
|
|
fmt.Printf("BenchmarkExportSize:%s 1 %d bytes\n", base.Ctxt.Pkgpath, size)
|
|
}
|
|
}
|