compiler: refactor defer operations

This commit is contained in:
Ayke van Laethem
2019-11-24 12:43:43 +01:00
committed by Ron Evans
parent 19bf8acde0
commit 405ec2a563
3 changed files with 120 additions and 111 deletions
+3 -3
View File
@@ -958,7 +958,7 @@ func (c *Compiler) parseFunc(frame *Frame) {
if frame.fn.Recover != nil {
// This function has deferred function calls. Set some things up for
// them.
c.deferInitFunc(frame)
frame.deferInitFunc()
}
// Fill blocks with instructions.
@@ -1044,7 +1044,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
case *ssa.DebugRef:
// ignore
case *ssa.Defer:
c.emitDefer(frame, instr)
frame.createDefer(instr)
case *ssa.Go:
// Get all function parameters to pass to the goroutine.
var params []llvm.Value
@@ -1127,7 +1127,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
c.builder.CreateRet(retVal)
}
case *ssa.RunDefers:
c.emitRunDefers(frame)
frame.createRunDefers()
case *ssa.Send:
frame.createChanSend(instr)
case *ssa.Store: