A Virtual Machine for Higher-Order Reactors
Bjarno Oeyen, Jens Nicolay, Wolfgang De Meuter · 2024
We present the design of a Remus, a virtual machine for reactive (RP) programs — signal-based programs that react automatically to changes — that is currently under development. The design of Remus been tailored specifically for reactive programs: it has a dedicated instruction set and memory model that is compatible with the model of reactive programming. The virtual machine allows reactive programs to be evaluated without needing to compile them to native code, nor by running them on an existing (general-purpose) virtual machine that is not specific to RP. The model of the virtual machine makes it possible to reason over the various behavioural aspects of a reactive program, such as memory consumption, in a language-agnostic way. As an example, we propose a static analysis that aims to eliminate dynamic allocations that occur in dynamic reactive programs: i.e., programs where the dependencies between the signals that make up a program changes at run-time. We show that our virtual machine, supplemented by the results of the analysis, allows for (well-behaved) reactive programs to be evaluated in constant space (i.e. in bounded memory) even when dependencies change or new signals are created programmatically.