rust/compiler/rustc_data_structures
Andreas Molzer a41e2fd963 Convert the recursive find_state to a loop
The basic conversion is a straightforward conversion of the linear
recursion to a loop forwards and backwards propagation of the result.
But this uses an optimization to avoid the need for extra space that
would otherwise be necessary to store the stack of unfinished states as
the function is not tail recursive.

Observe that only non-root-nodes in cycles have a recursive call and
that every such call overwrites their own node state. Thus we reuse the
node state itself as temporary storage for the stack of unfinished
states by inverting the links to a chain back to the previous state
update. When we hit the root or end of the full explored chain we
propagate the node state update backwards by following the chain until
a node with a link to itself.
2020-11-05 19:24:49 +01:00
..
src Convert the recursive find_state to a loop 2020-11-05 19:24:49 +01:00
Cargo.toml Upgrade to measureme 9.0.0 2020-10-24 22:39:42 -04:00