MCPcopy Create free account
hub / github.com/yuin/gopher-lua / callGFunction

Function callGFunction

_vm.go:105–131  ·  view source on GitHub ↗
(L *LState, tailcall bool)

Source from the content-addressed store, hash-verified

103}
104
105func callGFunction(L *LState, tailcall bool) bool {
106 frame := L.currentFrame
107 gfnret := frame.Fn.GFunction(L)
108 if tailcall {
109 L.currentFrame = L.RemoveCallerFrame()
110 }
111
112 if gfnret < 0 {
113 switchToParentThread(L, L.GetTop(), false, false)
114 return true
115 }
116
117 wantret := frame.NRet
118 if wantret == MultRet {
119 wantret = gfnret
120 }
121
122 if tailcall && L.Parent != nil && L.stack.Sp() == 1 {
123 switchToParentThread(L, wantret, false, true)
124 return true
125 }
126
127 // +inline-call L.reg.CopyRange frame.ReturnBase L.reg.Top()-gfnret -1 wantret
128 L.stack.Pop()
129 L.currentFrame = L.stack.Last()
130 return false
131}
132
133func threadRun(L *LState) {
134 if L.stack.IsEmpty() {

Callers 3

mainLoopFunction · 0.70
mainLoopWithContextFunction · 0.70
initFunction · 0.70

Calls 6

switchToParentThreadFunction · 0.70
SpMethod · 0.65
PopMethod · 0.65
LastMethod · 0.65
RemoveCallerFrameMethod · 0.45
GetTopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…