Skip to content

Commit d1c6adf

Browse files
committed
Add a note on indirect calls to replaceLinearBody
1 parent ab8b986 commit d1c6adf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

unison-runtime/src/Unison/Runtime/ANF/Optimize.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,19 @@ linearTail opts self vs bound rec ar kf0 tm
747747
-- body. This does not obey the normal inlining classification, so it
748748
-- may inline a function that makes indirect calls, and needs to
749749
-- account for that. This allows us to see more linear situations.
750+
--
751+
-- Note: this does _not_ fix the `Direction` numbering in the result.
752+
-- The numbering is intended to allow returning to specific points
753+
-- within a function; each number mapping to a code section that is
754+
-- the rest of the function from that point.
755+
--
756+
-- However, this is not used during normal code execution. `Let` in
757+
-- code directly stores its body. The numbering is used to reconstruct
758+
-- continuations from the interchange format, since they only send the
759+
-- numbers. However, _affine_ handlers are only use in contexts where
760+
-- continuations aren't captured, so we don't actually need a correct
761+
-- numbering. If this is ever changed, then the numbering here must be
762+
-- adjusted.
750763
replaceLinearBody :: (Var v) => OptInfos v -> ANormal v -> ANormal v
751764
replaceLinearBody (arities, inls) bd
752765
| TCom r vs <- bd,

0 commit comments

Comments
 (0)