> It seems to me that trying to determine max stack size is incompatible with
> dynamic linking. So even if you disallow recursion, any function that calls
> a function outside of its own crate is not going to be able to trust its
> calculated max stack size.
The maximum stack size needs to be computed dynamically, in a "C++ global
constructor" placed by rustc in all crate compiled libraries/executables that
would write the computed value in suitable global variables.
The check only needs to be done by task creation routines, by function calls
contained in a recursion cycle, by closures and by stubs put in ~Trait/@Trait
vtables (where Trait is public and thus implementable by other crates).
Note that the latter two cannot really be avoided by taking the max over all
implementations dynamically because a new dynamic library could be loaded
between the check and the indirect call.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev