Hi
You are correct, my original transformation was not very well spelled out.
Effectively, I'm transforming a normal method into a method where the take
happens in the caller and the drop happens in
the callee.
It'll consume two stack frames - one for the original method, and one for the
extra helper method.
So perhaps a better writing of the transform is this: (leaving out the
additional transforming required for early returns)
original method
----------------------
void foo(T param1) {
T var1 = ...
foo(var1)
}
transformed method
-----------------------------
void foo(T param1) {
T var1 = ....
take(var1)
foo_helper(var1)
}
void foo_helper(T param1) {
foo_helper_start:
T var1 = ...
take(var1)
drop(param1)
param1 = var1 // assign reference
goto foo_helper_start
}
Marijn Haverbeke wrote:
>> Perhaps it would be possible to apply some compile-time transformation to
>> mitigate the problem:
> I don't really understand your transformation, but it seems like the
> resulting code would still consume stack space for the 'tail' call.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev