Skip to content

Commit 405ec2a

Browse files
aykevldeadprogram
authored andcommitted
compiler: refactor defer operations
1 parent 19bf8ac commit 405ec2a

File tree

3 files changed

+120
-111
lines changed

3 files changed

+120
-111
lines changed

compiler/compiler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ func (c *Compiler) parseFunc(frame *Frame) {
958958
if frame.fn.Recover != nil {
959959
// This function has deferred function calls. Set some things up for
960960
// them.
961-
c.deferInitFunc(frame)
961+
frame.deferInitFunc()
962962
}
963963

964964
// Fill blocks with instructions.
@@ -1044,7 +1044,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
10441044
case *ssa.DebugRef:
10451045
// ignore
10461046
case *ssa.Defer:
1047-
c.emitDefer(frame, instr)
1047+
frame.createDefer(instr)
10481048
case *ssa.Go:
10491049
// Get all function parameters to pass to the goroutine.
10501050
var params []llvm.Value
@@ -1127,7 +1127,7 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) {
11271127
c.builder.CreateRet(retVal)
11281128
}
11291129
case *ssa.RunDefers:
1130-
c.emitRunDefers(frame)
1130+
frame.createRunDefers()
11311131
case *ssa.Send:
11321132
frame.createChanSend(instr)
11331133
case *ssa.Store:

0 commit comments

Comments
 (0)