Skip to content

Commit

Permalink
ssa.Go check ctx.RunContext dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Jun 7, 2023
1 parent 8297aa7 commit 280830b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions opblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,10 +916,10 @@ func makeInstr(interp *Interp, pfn *function, instr ssa.Instruction) func(fr *fr
}
case *ssa.Go:
iv, ia, ib := getCallIndex(pfn, &instr.Call)
if interp.ctx.RunContext != nil {
return func(fr *frame) {
fn, args := interp.prepareCall(fr, &instr.Call, iv, ia, ib)
atomic.AddInt32(&interp.goroutines, 1)
return func(fr *frame) {
fn, args := interp.prepareCall(fr, &instr.Call, iv, ia, ib)
atomic.AddInt32(&interp.goroutines, 1)
if interp.ctx.RunContext != nil {
go func() {
root := &frame{interp: interp}
switch f := fn.(type) {
Expand All @@ -937,11 +937,7 @@ func makeInstr(interp *Interp, pfn *function, instr ssa.Instruction) func(fr *fr
interp.callDiscardsResult(root, fn, args, instr.Call.Args)
atomic.AddInt32(&interp.goroutines, -1)
}()
}
} else {
return func(fr *frame) {
fn, args := interp.prepareCall(fr, &instr.Call, iv, ia, ib)
atomic.AddInt32(&interp.goroutines, 1)
} else {
go func() {
interp.callDiscardsResult(&frame{}, fn, args, instr.Call.Args)
atomic.AddInt32(&interp.goroutines, -1)
Expand Down

0 comments on commit 280830b

Please sign in to comment.