falco icon indicating copy to clipboard operation
falco copied to clipboard

Store function call state in a stack

Open richardmarshall opened this issue 11 months ago • 1 comments

As functions are called store the current execution state for the function in a stack. This includes the local variables and re.group.{N} variables.

This stack is used to detect recursion and prevent an interpreter panic.

In the future this information could be used for including a VCL stack trace in error output or for accessing calling function state in the debugger.

Note: The current code structure makes accessing the re.group variables directly from the stack pointer a challenge. To keep things simple I retained the save / restore model we currently have for those. If there is consensus on the idea of using a stack frame model we can decide if it makes sense to restructure things to make access through the stack pointer possible.

Resolves #293, #297

richardmarshall avatar Apr 03 '24 01:04 richardmarshall