G3Kappa / Ergo

Other
4 stars 0 forks source link

Determinacy detection #83

Closed G3Kappa closed 6 months ago

G3Kappa commented 6 months ago

Determining whether a predicate is determinate is important for a variety of optimizations.

First of all, it makes TCO more sound in the context of #56. Second of all, it can be used in the context of solution generators which are a recent addition for representing large amounts of solutions without allocating a ton of memory.

A simple example of a solution generator is for/4: if the continuation is determinate, then the loop can be unrolled into a solution generator that yields its solutions when they are actually accessed and not one moment before. If the continuation were not determinate this optimization would not work.

G3Kappa commented 6 months ago

Closed by #84. Not all predicates have been marked as det yet, but it can be done gradually because the worst thing that can happen is that some optimizations are not applied.

See VMFlags.IsContinuationDet