mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge
(Last?) Semi-regular merge from tip to dev.ssa. Conflicts: src/cmd/compile/internal/gc/closure.go src/cmd/compile/internal/gc/gsubr.go src/cmd/compile/internal/gc/lex.go src/cmd/compile/internal/gc/pgen.go src/cmd/compile/internal/gc/syntax.go src/cmd/compile/internal/gc/walk.go src/cmd/internal/obj/pass.go Change-Id: Ib5ea8bf74d420f4902a9c6208761be9f22371ae7
This commit is contained in:
commit
4fffd4569d
240 changed files with 4682 additions and 3188 deletions
|
|
@ -149,11 +149,11 @@ type Param struct {
|
|||
// Func holds Node fields used only with function-like nodes.
|
||||
type Func struct {
|
||||
Shortname *Node
|
||||
Enter *NodeList // for example, allocate and initialize memory for escaping parameters
|
||||
Exit *NodeList
|
||||
Cvars *NodeList // closure params
|
||||
Dcl *NodeList // autodcl for this func/closure
|
||||
Inldcl *NodeList // copy of dcl for use in inlining
|
||||
Enter Nodes // for example, allocate and initialize memory for escaping parameters
|
||||
Exit Nodes
|
||||
Cvars Nodes // closure params
|
||||
Dcl []*Node // autodcl for this func/closure
|
||||
Inldcl *[]*Node // copy of dcl for use in inlining
|
||||
Closgen int
|
||||
Outerfunc *Node
|
||||
Fieldtrack []*Type
|
||||
|
|
@ -169,18 +169,12 @@ type Func struct {
|
|||
Depth int32
|
||||
|
||||
Endlineno int32
|
||||
WBLineno int32 // line number of first write barrier
|
||||
|
||||
Norace bool // func must not have race detector annotations
|
||||
Nosplit bool // func should not execute on separate stack
|
||||
Noinline bool // func should not be inlined
|
||||
Nowritebarrier bool // emit compiler error instead of write barrier
|
||||
Nowritebarrierrec bool // error on write barrier in this or recursive callees
|
||||
Dupok bool // duplicate definitions ok
|
||||
Wrapper bool // is method wrapper
|
||||
Needctxt bool // function uses context register (has closure variables)
|
||||
Systemstack bool // must run on system stack
|
||||
|
||||
WBLineno int32 // line number of first write barrier
|
||||
Pragma Pragma // go:xxx function annotations
|
||||
Dupok bool // duplicate definitions ok
|
||||
Wrapper bool // is method wrapper
|
||||
Needctxt bool // function uses context register (has closure variables)
|
||||
}
|
||||
|
||||
type Op uint8
|
||||
|
|
@ -491,3 +485,55 @@ func count(l *NodeList) int {
|
|||
}
|
||||
return int(n)
|
||||
}
|
||||
|
||||
// Nodes is a pointer to a slice of *Node.
|
||||
// For fields that are not used in most nodes, this is used instead of
|
||||
// a slice to save space.
|
||||
type Nodes struct{ slice *[]*Node }
|
||||
|
||||
// Slice returns the entries in Nodes as a slice.
|
||||
// Changes to the slice entries (as in s[i] = n) will be reflected in
|
||||
// the Nodes.
|
||||
func (n *Nodes) Slice() []*Node {
|
||||
if n.slice == nil {
|
||||
return nil
|
||||
}
|
||||
return *n.slice
|
||||
}
|
||||
|
||||
// NodeList returns the entries in Nodes as a NodeList.
|
||||
// Changes to the NodeList entries (as in l.N = n) will *not* be
|
||||
// reflect in the Nodes.
|
||||
// This wastes memory and should be used as little as possible.
|
||||
func (n *Nodes) NodeList() *NodeList {
|
||||
if n.slice == nil {
|
||||
return nil
|
||||
}
|
||||
var ret *NodeList
|
||||
for _, n := range *n.slice {
|
||||
ret = list(ret, n)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Set sets Nodes to a slice.
|
||||
// This takes ownership of the slice.
|
||||
func (n *Nodes) Set(s []*Node) {
|
||||
if len(s) == 0 {
|
||||
n.slice = nil
|
||||
} else {
|
||||
n.slice = &s
|
||||
}
|
||||
}
|
||||
|
||||
// Append appends entries to Nodes.
|
||||
// If a slice is passed in, this will take ownership of it.
|
||||
func (n *Nodes) Append(a ...*Node) {
|
||||
if n.slice == nil {
|
||||
if len(a) > 0 {
|
||||
n.slice = &a
|
||||
}
|
||||
} else {
|
||||
*n.slice = append(*n.slice, a...)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue