mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: remove extra typ field in Name struct
Noticed the typ field was duplicated, since it is also in miniExpr inside Name. Also clarified the comments for Func, now that it is actually the ODCLFUNC node. Change-Id: Ia483a0ad34bb409cd92c43d4ae0a6852f9e4f644 Reviewed-on: https://go-review.googlesource.com/c/go/+/274619 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
64bc656aed
commit
5a3b6796cd
3 changed files with 9 additions and 9 deletions
|
|
@ -17,13 +17,14 @@ import (
|
||||||
//
|
//
|
||||||
// There are multiple nodes that represent a Func in the IR.
|
// There are multiple nodes that represent a Func in the IR.
|
||||||
//
|
//
|
||||||
// The ONAME node (Func.Name) is used for plain references to it.
|
// The ONAME node (Func.Nname) is used for plain references to it.
|
||||||
// The ODCLFUNC node (Func.Decl) is used for its declaration code.
|
// The ODCLFUNC node (the Func itself) is used for its declaration code.
|
||||||
// The OCLOSURE node (Func.Closure) is used for a reference to a
|
// The OCLOSURE node (Func.OClosure) is used for a reference to a
|
||||||
// function literal.
|
// function literal.
|
||||||
//
|
//
|
||||||
// A Func for an imported function will have only an ONAME node.
|
// An imported function will have an ONAME node which points to a Func
|
||||||
// A declared function or method has an ONAME and an ODCLFUNC.
|
// with an empty body.
|
||||||
|
// A declared function or method has an ODCLFUNC (the Func itself) and an ONAME.
|
||||||
// A function literal is represented directly by an OCLOSURE, but it also
|
// A function literal is represented directly by an OCLOSURE, but it also
|
||||||
// has an ODCLFUNC (and a matching ONAME) representing the compiled
|
// has an ODCLFUNC (and a matching ONAME) representing the compiled
|
||||||
// underlying form of the closure, which accesses the captured variables
|
// underlying form of the closure, which accesses the captured variables
|
||||||
|
|
@ -44,8 +45,8 @@ import (
|
||||||
// the method name is stored in Sym instead of Right.
|
// the method name is stored in Sym instead of Right.
|
||||||
// Each OCALLPART ends up being implemented as a new
|
// Each OCALLPART ends up being implemented as a new
|
||||||
// function, a bit like a closure, with its own ODCLFUNC.
|
// function, a bit like a closure, with its own ODCLFUNC.
|
||||||
// The OCALLPART has uses n.Func to record the linkage to
|
// The OCALLPART uses n.Func to record the linkage to
|
||||||
// the generated ODCLFUNC (as n.Func.Decl), but there is no
|
// the generated ODCLFUNC, but there is no
|
||||||
// pointer from the Func back to the OCALLPART.
|
// pointer from the Func back to the OCALLPART.
|
||||||
type Func struct {
|
type Func struct {
|
||||||
miniNode
|
miniNode
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ type Name struct {
|
||||||
flags bitset16
|
flags bitset16
|
||||||
pragma PragmaFlag // int16
|
pragma PragmaFlag // int16
|
||||||
sym *types.Sym
|
sym *types.Sym
|
||||||
typ *types.Type
|
|
||||||
fn *Func
|
fn *Func
|
||||||
offset int64
|
offset int64
|
||||||
val constant.Value
|
val constant.Value
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ func TestSizeof(t *testing.T) {
|
||||||
_64bit uintptr // size on 64bit platforms
|
_64bit uintptr // size on 64bit platforms
|
||||||
}{
|
}{
|
||||||
{Func{}, 168, 288},
|
{Func{}, 168, 288},
|
||||||
{Name{}, 128, 224},
|
{Name{}, 124, 216},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue