-
Notifications
You must be signed in to change notification settings - Fork 689
Closed
Description
- GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
- GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.
Please answer the following before submitting your issue:
- What version of GopherLua are you using? : 46796da
- What version of Go are you using? : go version go1.10.3 darwin/amd64
- What operating system and processor architecture are you using? : x86_64
- What did you do? : N/A
- What did you expect to see? : N/A
- What did you see instead? : N/A
In state.go, the Remove method which is used in tail calls has a loop in it that can only execute once, due to the assignment of cs.sp = i which causes the loop to break. I think probably this loop is intended to run through the whole stack.
func (cs *callFrameStack) Remove(sp int) {
psp := sp - 1
nsp := sp + 1
var pre *callFrame
var next *callFrame
if psp > 0 {
pre = &cs.array[psp]
}
if nsp < cs.sp {
next = &cs.array[nsp]
}
if next != nil {
next.Parent = pre
}
for i := sp; i+1 < cs.sp; i++ {
cs.array[i] = cs.array[i+1]
cs.array[i].Idx = i
cs.sp = i
}
cs.sp++
}
I suspect this is not causing a problem at the moment as this method is only called when making a tail call where it only has to repair 1 stack frame.
Metadata
Metadata
Assignees
Labels
No labels