Dan Sugalski wrote:
If the point is to direct the allocator to flush temps and start fresh, then we should just do it:
.flushtemps
The point basically is to insert a loop into the CFG. When we have
foo() ... bar()
which is a linear control flow through these basic blocks, we need:
invoke --> foo(), captures continuation cont_label: .... invoke_or_branch cont_label -- bar()
as the invocation of bar() can turn into a continuation resume at cont_label.
2) Fetch all from lexicals/globals after a function call.
This should only be necessary for volatile I and N values for normal
No. During a linear control flow, the register allocator can reuse a register. E.g.
$P0 = a + b [1] foo() [2] print $P0 [3] $P1 = new .Schrott [4] bar() [5] print $P1
[1] $P0 get e.g. P16 - preserved over call to foo()
[2] inside foo() the continuation is captured and made available for bar
[3] all fine first, P16 is valid
[4] $P0 isn't in use anymore. If this is a linear control flow, as it looks like, $P1 gets register P16, as it needs being preserved over the call to bar
[5] the call to bar uses the passed continuation and re-enters after the call in [2], it has created a loop.
Result: the print statements in [3] fails.
This does *not* depend on any register type, nor if it's a temp or a lexical.
leo