Dictu icon indicating copy to clipboard operation
Dictu copied to clipboard

STACK_MAX is a constant

Open Jason2605 opened this issue 5 years ago • 1 comments

STACK_MAX is a constant and there is no checking in push() to see if we have hit the stack limit. This is for good reason, as push() happens so frequently, a branch in here would hit performance significantly, however this does mean the VM can run into undefined behaviour if the stack count out grows the hard constant. This should instead be a value based on the "worst case" amount of values worked out at compile time.

Jason2605 avatar Jan 26 '20 19:01 Jason2605

Microsoft's C/C++ compiler uses chkstck to handle such an event, I recommend you take a look at it:

https://docs.microsoft.com/en-us/windows/win32/devnotes/-win32-chkstk

kayomn avatar Feb 03 '20 18:02 kayomn