To have no stack limit, we avoid the native stack and use a manually programmed stack for certain unary and binary predicates. An exception to this approach is major and minor garbage collection that we do with a Peter Deutsch algorithm extended from binary cells to n-ary compounds, using an integer index walk instead of bit combinations.
Where possible the algorithms are tail recursive, so that the
extra stack only grows for Prolog arguments except for the last
one, making the approach suitable for large list processing. This
also illustrates our decision, to not use the logging from union
find where possible, and use two main passes to undo markings or
functor modifications instead.
The following stack host calls are provided: