Skip to content

Add interruptible effect to enable freeze detection #97

@stephanemagnenat

Description

@stephanemagnenat

In embedded context, such as when used within Candli, it is not acceptable that incorrect Ferlium code — such as an infinite loop — freezes the whole Candli runtime.

Once we compile Ferlium, we need to insert freeze detection inside the compiled code (e.g. at the CFG's loop back edges), and if the computing budget is consumed, generate a runtime error. However, this affects the calling convention, as if at least one freeze detection is performed, the enclosing function must be able to panic (i.e. being fallible).

A clean solution is to add an interruptable effect that, when present in a function, forces the ABI to generate panic support code. To achieve this, the IR must already be able to encode whether or not a function contains interruptable code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effectThe side-effect tracking system

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions