Commit 25946645 authored by Håvard Haugen's avatar Håvard Haugen Committed by Brad Fitzpatrick

cmd/compile/internal/gc: unexport and make Hasdefer a bool

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I804ee4252fa9be78cb277faf7f467e6c9cfdd4a6
Reviewed-on: https://go-review.googlesource.com/14319
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 704e05c6
......@@ -2399,7 +2399,7 @@ func Ginscall(f *Node, proc int) {
if proc == 1 {
Ginscall(Newproc, 0)
} else {
if Hasdefer == 0 {
if !hasdefer {
Fatalf("hasdefer=0 but has defer")
}
Ginscall(Deferproc, 0)
......@@ -2622,7 +2622,7 @@ func cgen_ret(n *Node) {
if n != nil {
Genlist(n.List) // copy out args
}
if Hasdefer != 0 {
if hasdefer {
Ginscall(Deferreturn, 0)
}
Genlist(Curfn.Func.Exit)
......
......@@ -616,7 +616,7 @@ var blockgen int32 // max block number
var block int32 // current block number
var Hasdefer int // flag that curfn has defer statetment
var hasdefer bool // flag that curfn has defer statement
var Curfn *Node
......
......@@ -392,7 +392,7 @@ func compile(fn *Node) {
goto ret
}
Hasdefer = 0
hasdefer = false
walk(Curfn)
if nerrors != 0 {
goto ret
......@@ -487,7 +487,7 @@ func compile(fn *Node) {
// TODO: Determine when the final cgen_ret can be omitted. Perhaps always?
cgen_ret(nil)
if Hasdefer != 0 {
if hasdefer {
// deferreturn pretends to have one uintptr argument.
// Reserve space for it so stack scanner is happy.
if Maxarg < int64(Widthptr) {
......
......@@ -486,7 +486,7 @@ func mkvar(f *Flow, a *obj.Addr) Bits {
//
// Disable registerization for results if using defer, because the deferred func
// might recover and return, causing the current values to be used.
if node.Class == PEXTERN || (Hasdefer != 0 && node.Class == PPARAMOUT) {
if node.Class == PEXTERN || (hasdefer && node.Class == PPARAMOUT) {
v.addr = 1
}
......
......@@ -231,7 +231,7 @@ func walkstmt(np **Node) {
walkstmt(&n.Right)
case ODEFER:
Hasdefer = 1
hasdefer = true
switch n.Left.Op {
case OPRINT, OPRINTN:
walkprintfunc(&n.Left, &n.Ninit)
......
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