Description
The current VM implementation of block expressions disables OSR while inside a block expression to avoid some issues with temps on expression stack. This is okay for a first implementation, since widget loops inside control flow collections can be expected to be short running. However, for a high quality implementation, we should enable OSR even inside those blocks, since it is always possible to write a contrived long running loop. This bug tracks the progress of that work.
Probably biggest VM item left to be explored is enabling OSR points inside control flow collection for loops. Alex notes we should ensure that temporaries on the expression stack are preserved when OSR happens.
Consider a more complex expression like
var x = x.bar(42, bazz(), 'abc', [more_bazz(), for (int i = 0; i < n; i++) 2*i ]);
In this case x, 42, bazz() and 'abc' should be on the expression stack unless CFE introduces temporary variables for them. Let's:
(1) test if the above example works;
(2) dump kernel to see how CFE generates this;
(3) print flowgraph of a function compiled for OSR and check that it loads captured values correctly.