// Compiling the standard library
var compiling_std bool
-var compiling_wrappers int
+var compiling_wrappers bool
var use_writebarrier bool
if !sig.isym.Siggen() {
sig.isym.SetSiggen(true)
if !eqtype(this, it) || this.Width < int64(Widthptr) {
- compiling_wrappers = 1
- genwrapper(it, f, sig.isym, 1)
- compiling_wrappers = 0
+ compiling_wrappers = true
+ genwrapper(it, f, sig.isym, true)
+ compiling_wrappers = false
}
}
if !sig.tsym.Siggen() {
sig.tsym.SetSiggen(true)
if !eqtype(this, t) {
- compiling_wrappers = 1
- genwrapper(t, f, sig.tsym, 0)
- compiling_wrappers = 0
+ compiling_wrappers = true
+ genwrapper(t, f, sig.tsym, false)
+ compiling_wrappers = false
}
}
}
isym := methodsym(method, t, false)
if !isym.Siggen() {
isym.SetSiggen(true)
- genwrapper(t, f, isym, 0)
+ genwrapper(t, f, isym, false)
}
}
s.stmtList(n.List)
b := s.exit()
b.Kind = ssa.BlockRetJmp // override BlockRet
- b.Aux = n.Left.Sym.Linksym()
+ b.Aux = n.Sym.Linksym()
case OCONTINUE, OBREAK:
var to *ssa.Block
// rcvr - U
// method - M func (t T)(), a TFIELD type struct
// newnam - the eventual mangled name of this function
-func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym, iface int) {
+func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym, iface bool) {
if false && Debug['r'] != 0 {
fmt.Printf("genwrapper rcvrtype=%v method=%v newnam=%v\n", rcvr, method, newnam)
}
t := nod(OTFUNC, nil, nil)
l := []*Node{this}
- if iface != 0 && rcvr.Width < int64(Widthptr) {
+ if iface && rcvr.Width < int64(Widthptr) {
// Building method for interface table and receiver
// is smaller than the single pointer-sized word
// that the interface call will pass in.
as := nod(OAS, this.Left, nod(OCONVNOP, dot, nil))
as.Right.Type = rcvr
fn.Nbody.Append(as)
- n := nod(ORETJMP, nil, nil)
- n.Left = newname(methodsym(method.Sym, methodrcvr, false))
- fn.Nbody.Append(n)
+ fn.Nbody.Append(nodSym(ORETJMP, nil, methodsym(method.Sym, methodrcvr, false)))
// When tail-calling, we can't use a frame pointer.
fn.Func.SetNoFramePointer(true)
} else {
// n.Left = typecheck1(n.Left, top)
func typecheck1(n *Node, top int) *Node {
switch n.Op {
- case OXDOT, ODOT, ODOTPTR, ODOTMETH, ODOTINTER:
+ case OXDOT, ODOT, ODOTPTR, ODOTMETH, ODOTINTER, ORETJMP:
// n.Sym is a field/method name, not a variable.
default:
if n.Sym != nil {
}
}
- if safemode && !inimport && compiling_wrappers == 0 && t != nil && t.Etype == TUNSAFEPTR {
+ if safemode && !inimport && !compiling_wrappers && t != nil && t.Etype == TUNSAFEPTR {
yyerror("cannot use unsafe.Pointer")
}